package cc.vicp.djx314.starfood.web.activity;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import cc.vicp.djx314.starfood.domain.dish.Activity;
import cc.vicp.djx314.starfood.service.activity.CustomerActivityService;

@Controller
public class GetAllActivityEnabledSimpleInfoController {
	public static final Logger logger = LoggerFactory.getLogger(GetAllActivityEnabledSimpleInfoController.class);

	@Autowired
	CustomerActivityService customerActivityService;

	@RequestMapping(value = "/activity/all/simple", method = RequestMethod.GET)
	public ModelAndView getAllActivityEnabledSimpleInfo() {
		boolean isSuccess = false;
		List<Activity> activities = null;
		try {
			activities = customerActivityService.getAllActivityEnabledSimple();
			isSuccess = true;
		} catch (Exception e) {
			logger.info("获取所有活动简单信息出错", e);
		}
		ModelAndView model = new ModelAndView("jsontournamenttemplate");
		model.addObject("activities", activities);
		model.addObject("success", isSuccess);
		return model;
	}
}